package com.sky.mapper;

import com.sky.annotation.AutoFill;
import com.sky.dto.ShoppingCartDTO;
import com.sky.entity.ShoppingCart;
import com.sky.enumeration.OperationType;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface ShoppingCartMapper {

/**
 * 查询购物车
 * */
    List<ShoppingCart> list(ShoppingCart shoppingCart);
    /**
     * 根据id添加数量number
     * */
    @Update("update shopping_cart set number = #{number} where id = #{id}")
    void updateNumberById(ShoppingCart shoppingCart);

    void insert(ShoppingCart cart);


    @Delete("delete from shopping_cart where user_id = #{userid}")
    void cleanShoppingCart(Long userId);

    void subShoppingCart(ShoppingCart cart);


    // 批量插入购物车信息
    void insertBatch(List<ShoppingCart> shoppingCartList);
}
